package com.fzshang.api.controller;


import com.fzshang.commen.controller.BaseController;
import com.fzshang.commen.entity.ApiResult;
import com.fzshang.commen.service.UserService;
import com.fzshang.commen.util.pay.SenSms;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author 张思钦
 * @since 2019-06-04
 */
@Controller
@RequestMapping("/forget")
public class ForgetPasswordController extends BaseController {

    @Autowired
    UserService userService;

    //跳转找回密码页面
    @RequestMapping("/page")
    public String page(){
        return "forgetPassword/retrieve";
    }
    /**
     * @return 发送验证码
     */
    @RequestMapping(value = "/sendCaptcha", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "发送验证码")
    public ApiResult updatePhoneNumber(@RequestParam String phone) {

        if (SenSms.send(phone)) {
            return ApiResult.ok();
        } else {
            return ApiResult.fail();
        }
    }

    /**
     * @return 修改密码
     */
//    @RequestMapping(value = "resetPass", method = RequestMethod.POST)
//    @ResponseBody
//    @ApiOperation(value = "修改密码")
//    public Map updatePass(@RequestParam String pass, @RequestParam String phone, @RequestParam String code) {
//        return  userService.updatePass(pass,phone,code);
//    }





}
